Skip to content

Fix immediate sends with pending link previews#6280

Open
bytware-alpha wants to merge 1 commit into
signalapp:mainfrom
bytware-alpha:codex/link-preview-send-race
Open

Fix immediate sends with pending link previews#6280
bytware-alpha wants to merge 1 commit into
signalapp:mainfrom
bytware-alpha:codex/link-preview-send-race

Conversation

@bytware-alpha
Copy link
Copy Markdown

@bytware-alpha bytware-alpha commented May 29, 2026

Why

Sending a link should behave like sending any other message. The bubble should appear immediately; the preview can finish a beat later and still belong to that same bubble.

#4550 already ruled out the cheap fixes: blocking Send is bad UX, and sending the preview later is not what the user chose to send. So this does the actual thing: persist the outgoing row now, keep the preview attached to that send, and only hand the finalized payload to the sender.

This is better than the earlier durable-job shape because it does not teach the job queue about half-built sends. No runnable job exists until the message is final. Ordering is held with a small in-memory barrier, which is the sort of short-lived queueing pattern maintainers have accepted before in #4004 and #2529. Less machinery, cleaner contract.

How

  • Keep an in-flight link preview alive when Send wins the race.
  • Insert the outgoing message row immediately so the conversation stays stable.
  • Hold sender ordering with an in-memory deferred job barrier.
  • Attach the preview to the same row, then create the real sender job.
  • Keep edit/share approval paths using the same preview handoff.

Test Plan

  • xcodebuild test -workspace Signal.xcworkspace -scheme Signal -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' -only-testing:SignalServiceKitTests/MessageSenderJobQueueTest/test_deferredJobBlocksLaterJobsUntilStarted -only-testing:SignalTests/ThreadUtilSignalUITest/testPendingLinkPreviewDoesNotBlockOutgoingRowPersistence
  • xcodebuild test -workspace Signal.xcworkspace -scheme Signal -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5' -only-testing:SignalUITests/LinkPreviewFetchStateTest/testLinkPreviewDraftForSendingTaskSurvivesClearingCurrentText
  • PATH="/tmp/signal-swiftformat/SwiftFormat/.build/release:$PATH" Scripts/precommit.py --ref origin/main
  • git diff --check

@bytware-alpha bytware-alpha marked this pull request as ready for review May 29, 2026 07:01
@bytware-alpha bytware-alpha force-pushed the codex/link-preview-send-race branch from bcb4338 to e138892 Compare May 29, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant